home *** CD-ROM | disk | FTP | other *** search
/ The Arsenal Files 8 / The Arsenal Files Collection #8 (Arsenal Computer) (1996).ISO / g_quake / bort22.zip / SHELLS.QC < prev   
Text File  |  1996-10-09  |  3KB  |  86 lines

  1. //====================================================================
  2. //
  3. // SHOTGUN SHELLS            by: Perecli Manole AKA Bort
  4. //
  5. //====================================================================
  6. // Aside from this new file, the following are the modifications
  7. // done to id's original source files:
  8. //--------------------------------------------------------------------
  9. // File: Progs.src
  10. // Location: before the "weapons.qc" line
  11. // Added: shells.qc
  12. //--------------------------------------------------------------------
  13. // File: Weapons.qc
  14. // Procedure: W_Precache
  15. // Location: end of procedure
  16. // Added: precache_sound ("weapons/shellhit.wav"); // shotgun shells
  17. //--------------------------------------------------------------------
  18. // File: World.qc
  19. // Procedure: worldspawn
  20. // Location: at the end of all precache model definitions
  21. // Added: precache_model ("progs/shell.mdl");
  22. //--------------------------------------------------------------------
  23. // File: Weapons.qc
  24. // Procedure: W_FireShotgun 
  25. // Location: before "FireBullets (6, dir, '0.04 0.04 0');" line
  26. // Added: SpawnShell(); 
  27. //--------------------------------------------------------------------
  28. // File: Weapons.qc
  29. // Procedure: W_FireSuperShotgun
  30. // Location: before "FireBullets (14, dir, '0.14 0.08 0');" line
  31. // Added: SpawnShell(); SpawnShell(); 
  32. //--------------------------------------------------------------------
  33. // File: Client.qc
  34. // Procedure: ClientConnect
  35. // Location: next line after bprint (" entered the game\n");
  36. // Added: centerprint("This server supports: ...bla.bla.bla..");
  37. //--------------------------------------------------------------------
  38.  
  39. float () crandom;   // prototype
  40.  
  41.  
  42. //--------------------------------------------------------------------
  43. // Plays hit sound when shell hits hard surface if not stuck in loop
  44. //--------------------------------------------------------------------
  45. void() ShellHit =
  46. {
  47.     if (self.ltime <= (time - 0.2))   // prevent sound if last shell hit sound occured within last 2 frames
  48.         sound (self, CHAN_WEAPON, "weapons/shellhit.wav", 1, ATTN_NORM);
  49.     self.ltime = time;                // marks time of current touch trigger activation
  50. };
  51.  
  52.  
  53. //--------------------------------------------------------------------
  54. // Displays shell and defines its dynamic manifestation
  55. //--------------------------------------------------------------------
  56. void() DropShell = 
  57. {
  58.     self.movetype = MOVETYPE_BOUNCE;
  59.     self.solid = SOLID_BBOX;
  60.     setmodel (self, "progs/shell.mdl");
  61.     setsize (self, VEC_ORIGIN, VEC_ORIGIN);   
  62.     makevectors (self.owner.v_angle);
  63.     setorigin (self, self.owner.origin + v_forward * 10 - v_right*10);    
  64.     self.velocity = v_forward*30 + crandom()*v_forward*30 + v_up*220 + crandom()*v_up*10 - v_right*50 + crandom()*v_right*20;
  65.     self.avelocity_x = crandom()*500;
  66.     self.avelocity_y = crandom()*500;
  67.     self.avelocity_z = crandom()*500;
  68.     self.touch = ShellHit;
  69.     self.nextthink = time + 15;
  70.     self.think = SUB_Remove;
  71.     self.ltime = time - 1;
  72. };
  73.  
  74.  
  75. //--------------------------------------------------------------------
  76. // Spawns new shell entity but doesn't display it until reload time
  77. //--------------------------------------------------------------------
  78. void() SpawnShell=
  79. {
  80.     local entity shell;
  81.  
  82.     shell = spawn ();
  83.     shell.owner = self;
  84.     shell.nextthink = time + 0.4;         // delay shells until reload
  85.     shell.think = DropShell;
  86. };